package com.insigma.business.qrcode.common.converter;


import com.insigma.business.qrcode.job.dto.JobFairParticipateDTO;
import com.insigma.business.qrcode.job.dto.request.JobFairParticipateInsertRequest;
import com.insigma.business.qrcode.job.dto.request.JobFairParticipateSearchRequest;
import com.insigma.business.qrcode.job.dto.request.JobFairParticipateUpdateRequest;
import com.insigma.business.qrcode.job.dto.search.JobFairParticipateBSearcher;
import com.insigma.business.qrcode.soldier.entity.JobFairParticipateDO;
import org.springframework.beans.BeanUtils;

import java.util.List;


public class JobFairParticipateProviderConverter extends AbstractConverter<JobFairParticipateDTO, JobFairParticipateDO> {

    private final static JobFairParticipateProviderConverter jobFairParticipateConverter = new JobFairParticipateProviderConverter();

    private JobFairParticipateProviderConverter() {
    }


    public static JobFairParticipateBSearcher convertRequestSO2Searcher(final JobFairParticipateSearchRequest request) {
        final JobFairParticipateBSearcher jobFairParticipateBSearcher = new JobFairParticipateBSearcher(request.getPageNo(),
                request.getPageSize(), request.getSortKeyValueJoint());
        BeanUtils.copyProperties(request, jobFairParticipateBSearcher);
        return jobFairParticipateBSearcher;
    }


    public static JobFairParticipateDO convertRequestUO2DO(final JobFairParticipateUpdateRequest jobFairParticipateUpdateRequest) {
        final JobFairParticipateDO jobFairParticipateDO = new JobFairParticipateDO();
        BeanUtils.copyProperties(jobFairParticipateUpdateRequest, jobFairParticipateDO);

        return jobFairParticipateDO;
    }


    public static JobFairParticipateDO convertRequestIO2DO(final JobFairParticipateInsertRequest jobFairParticipateInsertRequest) {
        final JobFairParticipateDO jobFairParticipateDO = new JobFairParticipateDO();
        BeanUtils.copyProperties(jobFairParticipateInsertRequest, jobFairParticipateDO);
        return jobFairParticipateDO;
    }


    public static List<JobFairParticipateDTO> convertResponseDOList2DTOList(final List<JobFairParticipateDO> jobFairParticipateDOList) {
        return jobFairParticipateConverter.convertGenericResponseDOList2DTOList(jobFairParticipateDOList);
    }


    public static JobFairParticipateDTO convertResponseDO2DTO(final JobFairParticipateDO jobFairParticipateDO) {
        return jobFairParticipateConverter.convertGenericResponseDO2DTO(jobFairParticipateDO);
    }



    @Override
    protected JobFairParticipateDTO doConvertResponseDO2DTO(JobFairParticipateDO jobFairParticipateDO) {
        final JobFairParticipateDTO jobFairParticipateDTO = new JobFairParticipateDTO();
        try {
            BeanUtils.copyProperties(jobFairParticipateDO, jobFairParticipateDTO);
        } catch (RuntimeException be) {

            return null;
        }
        return jobFairParticipateDTO;
    }

}
